﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using webapi.Controllers;
using webapi.Models;

namespace webapi.views
{
  public partial class student : System.Web.UI.Page
  {
    protected string[] arr_thead = new string[] { "一", "二", "三", "四", "五", "六", "日" };
    protected string[] arr_tbody = new string[] { "09:00-10:20", "10:40-12:00", "12:30-13:50", "14:00-15:20", "15:30-16:50", "17:00-18:20", "19:00-20:20", "20:30-21:50" };
    protected string user_id = "1840226129";

    protected void Page_Load(object sender, EventArgs e)
    {
      try
      {
        //获取user_id
        user_id = Request.Cookies["user_id"].Value;
        //页面初始化
        this.init(user_id);

        Response.Write("<script>var stu_id = " + user_id + "</script>");
      }
      catch
      {
        this.showDialog("请登录");
        Response.Redirect("login.aspx");
      }
    }

    //初始化页面
    protected void init(string user_id)
    {
      //渲染thead
      myThead.InnerHtml = this.setThead();
      thead.InnerHtml = this.setThead();

    }

    //设置表头的数据
    protected string setThead()
    {
      string str_thead = "<tr><th></th>";
      for (int i = 0; i < 5; i++)
      {
        str_thead += "<th>星期" + arr_thead[i] + "</th>";
      }
      str_thead += "</tr>";
      return str_thead;
    }

    //弹窗
    protected void showDialog(string txt)
    {
      string str = "<script language='javascript'>alert('" + txt + "')</script>";
      string str1 = "<script language='javascript'>console.log('" + txt + "')</script>";
      Response.Write(str1);
      Response.Write(str);
    }

    protected void exit_Click(object sender, EventArgs e)
    {
      Response.Redirect("login.aspx");
      //Response.Write("<script>window.close();</script>");
    }

  }
}